package com.ocom.minio.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

/**
 * @Description: TODO
 * @Author: 朱晖
 * @Date: 2022/5/18
 **/

@Configuration
public class FileUploadConfig {
	@Bean
	public MultipartConfigElement multipartConfigElement() {
		MultipartConfigFactory factory = new MultipartConfigFactory();
		// 单个数据大小 KB,MB 大写
		factory.setMaxFileSize(DataSize.parse("10240MB"));
		// 总上传数据大小
		factory.setMaxRequestSize(DataSize.parse("10240MB"));
		return factory.createMultipartConfig();
	}
}
